#include "stdio.h"
#include "string.h"
#include "stdlib.h"

#define SIZE 5 

/*
unsigned char c ; //0-255
char c //0 -127
 */

 /*
int sckClit_sen(void *hanle, unsigned char *buf, int buflen)
//文件在磁盘上的存放有两种方式 asc方式可以的 、非asc（bin方式）
*/

typedef struct Student_
{    
	char name[10];
	int num;
	int age;
	char addr[15];
}Student;



int main()
{

	
	FILE *fp;
	int  i;

	Student student[SIZE];
	for (i=0; i<SIZE; i++)
	{
		memset(&student[i], 0, sizeof(Student));
		//sprintf(student[i].name, "name%d", i+1);
	}

	if((fp=fopen("./student1.data","rb"))==NULL)
	{    
		printf("cannot open file\n");
		return -1 ;
	}

	for(i=0;i<SIZE;i++)
	{   
		fread(&student[i],sizeof(Student),1,fp);
		printf("%-10s %4d %4d %-15s\n", student[i].name, 
										student[i].num,
										student[i].age,
										student[i].addr);
	}
	
	if(fp != NULL)
	{
		fclose(fp);
		fp = NULL;
	}
	

	
	return 0;
}